package edu.sctu.practice.class01.xialei.practice20150924;

/**
 * Created by huaiXIALEI on 2015/9/24.
 */
public class Counter {

    String name;
    float width;
    float height;
    float length;
    String color;
    String weight;
    String price;
    String productionPlace;

    boolean turn;

    public void start() {
        turn = true;
    }

    public void endOff(boolean whitck) {
        turn = false;
    }

    public float count(float numOne, float numTwo, String countType) {

        float result = 0;

        if (turn == true) {
             result = 0;

            switch (countType) {
                case "+":
                    result = numOne + numTwo;
                    break;
                case "-":
                    result = numOne - numTwo;
                    break;
                case "*":
                    result = numOne * numTwo;
                    break;
                case "/":
                    result = numOne / numTwo;
                default:
                    break;
            }

        } else {
            System.out.println("请先打开计算器!");
        }
        return result;
    }
}
